import { axios } from '@/utils/http/request'
// import { makeFormData } from '@/utils/util'

export const taskApi = {
  list: '/scen/task/list',
  chkList: '/scen/task/taskChkList',
  hsopLis: '/scen/task/queryHsopList',
  psnList: '/scen/task/queryPsnList',
  deptList: '/scen/task/queryDeptList',
  save: '/scen/task/save',
  info: '/scen/task/info/',
  issue: '/scen/task/isu',
  delete: '/scen/task/delete',
  psnChkList: '/scen/task/psnChkList',
  psnChInfo: '/scen/task/psnChInfo',
  psnChkSave: '/scen/task/psnChkSave'
}

// 获取任务列表
export function taskList (headers, params) {
  return axios({
    url: taskApi.list,
    method: 'post',
    headers,
    params
  })
}

// 获取任务审核列表
export function taskChkList (headers, params) {
  return axios({
    url: taskApi.chkList,
    method: 'post',
    headers,
    params
  })
}

// 获取任务审核详情列表
export function psnChkList (headers, params) {
  return axios({
    url: taskApi.psnChkList,
    method: 'post',
    headers,
    params
  })
}

// 获取任务详情列表
export function taskInfoList (headers, params) {
  return axios({
    url: taskApi.info + params.taskId,
    headers,
    method: 'get'
  })
}

export function hsopLis (headers, params) {
  return axios({
    url: taskApi.hsopLis,
    method: 'post',
    headers,
    params
  })
}

export function deptList (headers, params) {
  return axios({
    url: taskApi.deptList,
    method: 'post',
    headers,
    params
  })
}

export function psnList (headers, params) {
  return axios({
    url: taskApi.psnList,
    method: 'post',
    headers,
    params
  })
}

export function taskSubmit (params, data) {
  console.log(params, data)
  return axios({
    url: taskApi.save,
    method: 'post',
    params,
    data: { key: data, bodyType: 1 }
  })
}

export function issue (params) {
  return axios({
    url: taskApi.issue,
    method: 'post',
    params
  })
}

export function deleteHandle (params) {
  return axios({
    url: taskApi.delete,
    method: 'get',
    params
  })
}

export function psnChkSave (params) {
  return axios({
    url: taskApi.psnChkSave,
    method: 'get',
    params
  })
}

export function psnChInfo (params) {
  return axios({
    url: taskApi.psnChInfo,
    method: 'post',
    params
  })
}
